package advance.JVM.gc;

import java.util.ArrayList;
import java.util.List;

/**
 * description: <br>
 * createTime: 2018/11/1510:11 <br>
 *  VM Args:-XX:+PrintGCDetails
 * @author zzh
 */
public class RefCMSGC {

    public static void main(String[] args) {
        allocateMem();
        System.out.println("等待gc回收");
        try {
            Thread.sleep(1000000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

    }

    private static void allocateMem() {
        List<byte[]> list = new ArrayList<>();
        int size = 1024*1024*120;
        int block = 1024*20;
        int len = size / block;
        for (int i = 0; i < len;i++) {
            byte[] mem = new byte[block];
            list.add(mem);
        }

    }

}

